package com.zhuiyun.pm.client.bidding.controller;

import com.zhuiyun.pm.client.bidding.entity.ClientRunningWater;
import com.zhuiyun.pm.client.bidding.mapper.ClientRunningwaterMapper;
import com.zhuiyun.pm.client.bidding.service.ClientRunningWaterService;
import com.zhuiyun.pm.result.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/* *
 * @Author: hui
 * @Descriprion: 流水
 * @Date: 2023/3/14 19:53
 * @return null
 * @param null
 */
@RestController
@RequestMapping("/runningWater")
@CrossOrigin
public class ClientRunningWaterController {
    @Resource
    ClientRunningwaterMapper clientRunningwaterMapper;
    @Resource
    ClientRunningWaterService clientRunningWaterService;
    /* *
     * @Author: hui
     * @Descriprion: 全查无条件
     * @Date: 2023/3/14 19:01
     * @Return:
     * @return com.zhuiyun.pm.result.CommonResult
     * @Param:
     */
    @GetMapping("/findAll")
    public CommonResult findAll(){
       return  CommonResult.ok( clientRunningWaterService.findAll());
    }
    /**
     * @Author: hui
     * @Descriprion: 分页查询（page页数，size条数）
     * @Date: 2023/3/14 19:02
     * @return com.zhuiyun.pm.result.CommonResult
     * @param page
     * @param size
     */
    @PostMapping  ("/getpage")
    public CommonResult getlistpage(@RequestBody Map<String,Integer> map){
       Integer page= map.get("page");
       Integer size= map.get("size");
        System.out.println("page::"+page);
        System.out.println("size::"+size);
        return CommonResult.ok(clientRunningWaterService.page(page,size));
    }
    /* *          
     * @Author: hui
     * @Descriprion: 添加
     * @Date: 2023/3/14 19:02
     * @return com.zhuiyun.pm.result.CommonResult
     * @param clientRunningWater
     */
    @PostMapping("/add")
    public CommonResult add(@RequestBody ClientRunningWater clientRunningWater){
        return CommonResult.ok(clientRunningWaterService.lsbyid(clientRunningWater));
    }
}
